<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html>
<head>
<title> *** AJAX View ***</title>
<script type="text/javascript" src="/lookdom/js/jquery-1.8.0.js" charset="UTF-8"></script>
<script type="text/javascript">
	function viewAjaxList() {
		$.ajax({
			type	: "POST",
			url		: "/lookdom/listJson.do",
			dataType: "json",
			data	: "",
			success	: function(result) {
				$.each(result, function(key) {
					var list = result[key];
					var content = "<table border='1'>";
					
					for(var i = 0; i < list.length; i++) {
						content += "<tr>";
						content += "<td>" + list[i].ID + "</td>";
						content += "<td>" + list[i].NAME+ "</td>";
						content += "<td>" + list[i].TELNUMBER+ "</td>";
						content += "</tr>";
					}
					content += "</table>";
					$("#ajaxList").html(content);
				});
			}
		});
		
	}
</script>

</head>
<body>
	<div id="ajaxList"></div>
	<input type="button" value="리스트 가지고 오기" onclick="viewAjaxList()">
</body>
</html>